Routing has always been a critical aspect of data networking. In routing a packet at a network device, a routing structure (e.g., a routing table) is often used. A routing structure usually contains an address (e.g., IP address) of a destination network and an address of the next gateway along the path to the network destination. The packet is routed at least partially based on the address of the next gateway. In addition, prior to routing the packet out of the network device, the packet may be processed in a variety of ways through a set of functions such as extracting certain bytes from or adding certain bytes to the packet. The next gateway is often referred to as the next-hop. Using a routing structure to store a next-hop for known destinations and applying functions to process packets is often referred to as next-hop routing.
Packets at a network device are associated with applications. Packets of one application often have a common network destination and are also processed through same set of functions. Thus, a prefix can be associated to an application so that all traffic of the application may be routed similarly. Thus, next-hop routing is a combination of next-hop and prefix.
The need of an application for packet processing changes over time and an application may add or remove functions applicable to packets of the application at a network device. When that happens, routing related modules need to be updated through changing programming routing codes and this kind of updates is time consuming, labor intensive, and/or error prone, and a better mechanism is preferred to simplify next-hop routing.